#ifndef NEWTONINTERPOLATION_H
#define NEWTONINTERPOLATION_H

#include "../p1/Lagrange.h"
#include "../../utils/MatrixUtils.h"

namespace NumericalAnalysis
{
	// Returns the f[x0,...,xk] used by divided differences.
	// Input: [x0, y0] ... [xk, yk]
	// Output[j] = f[x0, ..., xj]
    Utils::Matriz DividedDifference(const Utils::Matriz& pairs);

    // Returns the newton productoria (x - xj) with 0 <= j < n
    double NewtonProductoria(const double x, const Utils::Matriz& pairs, const uint32_t n);

    // Returns the pairs of (xi, Pn(xi)), where Pn is the Newton polynomial of interpolation.
    Utils::Matriz NewtonInterpolation(const std::string& pairsFilePath, const uint32_t n, 
                                      const std::string& valuesFilePath, const uint32_t m);
}

#endif // NEWTONINTERPOLATION_H
